#ifndef SPOJENI_H
#define SPOJENI_H

#include <QAbstractSocket>
#include <QTcpSocket>
#include "ui_mainwindow.h"
#include "uzivatel.h"

class Spojeni : public QObject
{
    Q_OBJECT

public:
    Spojeni(Ui_MainWindow *u, QMainWindow *win);
    void socketWrite(QByteArray data);
    //void Message();
    bool registrace;
    void Status(QString s);

private:
    QTcpSocket* socket;
    Ui_MainWindow* ui;
    QMainWindow* w;
    bool loged;
    void Login();
    void List();
    void Ping();
    QList<Uzivatel> seznam;

public slots:
    void doConnect();
    void doDisconnect();
    void gotConnected();
    void gotDisconnected();
    void gotError(QAbstractSocket::SocketError error);
    void handleReply();
    void Send(QString i, QString z);

signals:
    void listChanged(QList<Uzivatel> sez);
    void blockGUI(bool b);
    void sPrijato(QString i, QString z);
    void sNotSend();

};

#endif // SPOJENI_H
